{% extends 'layout/base.twig' %}
{% import 'macros/helpers.twig' as helpers %}

{% block title %}
- 运行列表
{% endblock %}

{% block content %}

{% if runs|length or has_search %}
<div class="searchbar clearfix">
    <a href="#" class="pull-right btn btn-small search-expand" title="Show search form">
        <i class="icon-search"></i> 搜索
    </a>

    <form action="{{ url('home') }}" method="get" class="row hide search-form form-inline">
        <a href="#" class="search-collapse close" title="Hide search form">&times;</a>
        <div class="control-group span4">
            <label class="control-label" for="start_date">时间范围</label>
            <div class="controls">
                <input type="text" style="width: 80px;" name="date_start" value="{{ search.date_start }}" placeholder="开始时间" onclick="laydate({ istime: true, format: 'YYYY-MM-DD'})">
                <input type="text" style="width: 80px;" name="date_end" value="{{ search.date_end }}" placeholder="结束时间" onclick="laydate({ istime: true, format: 'YYYY-MM-DD'})">
            </div>
        </div>
        <div class="control-group span4">
            <label class="control-label" for="url">请求地址</label>
            <div class="controls">
                <input type="text" id="url" name="url" value="{{ search.url }}">
                <input type="hidden" name="sort" value="{{ paging.sort }}">
            </div>
        </div>
        <div class="form-actions">
            <button type="submit" class="btn btn-primary">搜索</button>
        </div>
    </form>
</div>
{% endif %}

{# No run data, and no search, must be just getting started #}
{% if not runs|length and not has_search %}
<div class="hero-unit">
    <h3>看起来你没有做任何配置</h3>
    <p>你需要收集一些分析数据才能开始使用XHGUI</p>
    <p>最简单的分析一个应用程序的方式是使用<code>external/header.php</code>。
        这个文件设计用来在PHP的
        <a href="http://www.php.net/manual/en/ini.core.php#ini.auto-prepend-file">auto_prepend_file</a>
		指令中使用。你可以在系统的<code>php.ini</code>中启用. 或者你也可以在每个虚拟主机中启用
        <code>auto_prepend_file</code>。 更多详细的细节可以查看<code>README.md</code>文件。
    </p>
</div>
{% endif %}

{% if runs|length or has_search %}
    {% include 'runs/paginated-list.twig' %}
{% endif %}

{% if runs|length %}
    {{ helpers.pagination('home', paging, search) }}
{% endif %}

{% endblock %}
